#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bird.h"
#include "eagle.h"

int main(int argc, char *argv[])
{
    struct Bird *Bird = (struct Bird *)malloc(sizeof(struct Bird));

    BirdInit(Bird);                   //调用构造函数
    Bird->SetName(Bird, "Lihua");        //更改Bird的名称
    Bird->SetColor(Bird, GREEN);         //更改Bird的颜色
    printf("Bird name: %s, color: %d\n", Bird->GetName(Bird), Bird->GetColor(Bird));
    Bird->LayEggs(Bird);
    BirdDeinit(Bird);                 //调用析构函数
    free(Bird);
    Bird = NULL;

    Bird = (struct Bird *)malloc(sizeof(struct Eagle));
    struct Eagle *Eagle = (struct Eagle *)Bird;
    EagleInit((struct Eagle *)Bird);
    Bird->SetName(Bird, "Tanmeimei");
    Bird->SetAddr(Bird, "Shanghai");
    Bird->SetColor(Bird, RED);
    printf("Eagle is fly: %d, is eate meat: %d\n", Eagle->IsFly((struct Bird *)Eagle), Eagle->IsEateMeat((struct Bird *)Eagle));
    printf("Eagle name is: %s,\n", Bird->GetName(Bird));
    Bird->LayEggs(Bird);
    EagleDeinit((struct Eagle *)Bird);
    free(Bird);
    Bird = NULL;

    return 0;
}